/**
 * Utils
 */

export const formatInt = (value) => {
  if (!value) return 0
  if (isNaN(value)) return 0
  if (typeof value === 'string') {
    const result = parseInt(value)
    if (isNaN(result)) return 0
    return result
  } else if (typeof value !== 'number') {
    return 0
  }
  return value
}
